const PAGE_FORM_COMPS_MAP = {
    'c$checkboxComp' : {
        name: '表单多选组件',
        input: {
            _name: '多选',
            _node: 'c$checkbox',
            _tag: 'JzlFormStar',
            _ss: {},
            _sh: {},
            _se: [ "input", "change", "focus", "blur" ]
        }
    },
    'c$colorComp': {
        name: '表单颜色组件',
        input: {
            _name: '颜色',
            _node: 'c$color',
            _tag: 'JzlFormColor',
            _ss: {},
            _sh: {},
            _se: [ "input", "change", "focus", "blur" ]
        }
    },
    'c$fileComp' : {
        name: '表单文件组件',
        input: {
            _name: '文件',
            _node: 'c$file',
            _tag: 'JzlFormFile',
            _ss: {},
            _sh: {},
            _se: [ "input", "change", "focus", "blur" ]
        }
    },
    'c$editorComp': {
        name: '表单富文本组件',
        input: {
            _name: '富文本',
            _node: 'c$editor',
            _tag: 'JzlFormEditor',
            _ss: {},
            _sh: {},
            _se: [ "input", "change", "focus", "blur" ]
        }
    },
    /*'c$formrelComp': {
        name: '表单父数据组件',
        input: {
            _name: '富文本',
            _node: 'c$formrel',
            _tag: 'JzlFormFormrel',
            _ss: {},
            _sh: {},
            _se: [ "input", "change", "focus", "blur" ]
        }
    },*/
    'c$iconComp': {
        name: '表单图标组件',
        input: {
            _name: '图标',
            _node: 'c$icon',
            _tag: 'JzlFormIcon',
            _ss: {},
            _sh: {},
            _se: [ "input", "change", "focus", "blur" ]
        }
    },
    'c$idcardComp': {
        name: '表单身份证组件',
        input: {
            _name: '身份证',
            _node: 'c$idcard',
            _tag: 'JzlFormIdcard',
            _ss: {},
            _sh: {},
            _se: [ "input", "change", "focus", "blur" ]
        }
    },
    'c$imageComp': {
        name: '表单图片组件',
        input: {
            _name: '图片',
            _node: 'c$image',
            _tag: 'JzlFormImage',
            _ss: {},
            _sh: {},
            _se: [ "input", "change", "focus", "blur" ]
        }
    },
    'c$inputComp': {
        name: '表单文本组件',
        input: {
            _name: '输入框',
            _node: 'c$input',
            _tag: 'JzlFormInput',
            _ss: {},
            _sh: {},
            _se: [ "input", "change", "focus", "blur" ]
        }
    },
    'c$linkComp': {
        name: '表单链接组件',
        input: {
            _name: '链接',
            _node: 'c$link',
            _tag: 'JzlFormLink',
            _ss: {},
            _sh: {},
            _se: [ "input", "change", "focus", "blur" ]
        }
    },
    'c$matrixComp': {
        name: '表单矩阵组件',
        input: {
            _name: '矩阵',
            _node: 'c$matrix',
            _tag: 'JzlFormMatrix',
            _ss: {},
            _sh: {},
            _se: [ "input", "change", "focus", "blur" ]
        }
    },
    'c$mbComp': {
        name: '表单码表组件',
        input: {
            _name: '码表',
            _node: 'c$mb',
            _tag: 'JzlFormMb',
            _ss: {},
            _sh: {},
            _se: [ "input", "change", "focus", "blur" ]
        }
    },
    'c$numberComp': {
        name: '表单数字组件',
        input: {
            _name: '数字',
            _node: 'c$number',
            _tag: 'JzlFormNumber',
            _ss: {},
            _sh: {},
            _se: [ "input", "change", "focus", "blur" ]
        }
    },
    'c$phoneComp': {
        name: '表单电话组件',
        input: {
            _name: '电话',
            _node: 'c$phone',
            _tag: 'JzlFormPhone',
            _ss: {},
            _sh: {},
            _se: [ "input", "change", "focus", "blur" ]
        }
    },
    'c$radioComp': {
        name: '表单单选组件',
        input: {
            _name: '单选',
            _node: 'c$radio',
            _tag: 'JzlFormRadio',
            _ss: {},
            _sh: {},
            _se: [ "input", "change", "focus", "blur" ]
        }
    },
    'c$roleComp': {
        name: '表单角色组件',
        input: {
            _name: '角色',
            _node: 'c$role',
            _tag: 'JzlFormRole',
            _ss: {},
            _sh: {},
            _se: [ "input", "change", "focus", "blur" ]
        }
    },
    'c$signComp': {
        name: '表单签名组件',
        input: {
            _name: '签名',
            _node: 'c$sign',
            _tag: 'JzlFormSign',
            _ss: {},
            _sh: {},
            _se: [ "input", "change", "focus", "blur" ]
        }
    },
    'c$sliderComp': {
        name: '表单滑块组件',
        input: {
            _name: '滑块',
            _node: 'c$slider',
            _tag: 'JzlFormSlider',
            _ss: {},
            _sh: {},
            _se: [ "input", "change", "focus", "blur" ]
        }
    },
    'c$switchComp': {
        name: '表单开关组件',
        input: {
            _name: '开关',
            _node: 'c$switch',
            _tag: 'JzlFormSwitch',
            _ss: {},
            _sh: {},
            _se: [ "input", "change", "focus", "blur" ]
        }
    },
    'c$starComp': {
        name: '表单评分组件',
        input: {
            _name: '评分',
            _node: 'c$star',
            _tag: 'JzlFormStar',
            _ss: {},
            _sh: {},
            _se: [ "input", "change", "focus", "blur" ]
        }
    },
    'c$tagComp': {
        name: '表单标签组件',
        input: {
            _name: '标签',
            _node: 'c$tag',
            _tag: 'JzlFormTag',
            _ss: {},
            _sh: {},
            _se: [ "input", "change", "focus", "blur" ]
        }
    },
    'c$timeComp': {
        name: '表单时间组件',
        input: {
            _name: '时间',
            _node: 'c$time',
            _tag: 'JzlFormTime',
            _ss: {},
            _sh: {},
            _se: [ "input", "change", "focus", "blur" ]
        }
    },
    'c$videoComp': {
        name: '表单视频组件',
        input: {
            _name: '视频',
            _node: 'c$video',
            _tag: 'JzlFormVideo',
            _ss: {},
            _sh: {},
            _se: [ "input", "change", "focus", "blur" ]
        }
    }
};

const box = {
    _name: '数字组件',
    _node: '',
    _ss: {},
    _sh: {},
    _rh: false,
    _sort: [ 'icon', 'label', 'body', 'rightIcon' ],
    _value: "numberValue",
    _ext: {
        tip: "你好，我是一个提示"
    },
    icon: {
        _name: '图标',
        _type: 'icon',
        _node: 'c$ffIcon',
        _ss: { },
        _sh: {},
        _rh: false
    },
    label: {
        _name: '标签文字',
        _type: 'text',
        _node: 'c$ffLabel',
        _ss: {
            "text": ""
        },
        _sh: {},
        _rh: false
    },
    body: {
        _name: '内容体',
        _node: 'c$ffBody',
        _ss: {},
        _sh: {},
        _rh: false,

        input: {
            _name: '评分',
            _node: 'c$star',
            _tag: 'JzlFormStar',
            _ss: {},
            _sh: {},
            _se: [ "input", "change", "focus", "blur" ]
        }
    },
    rightIcon: {
        _name: '右图标',
        _type: 'icon',
        _node: 'c$ffRightIcon',
        _ss: {},
        _sh: {},
        _rh: false
    }
};

const initPageFormItem = (config) => {
    for(let compName in PAGE_FORM_COMPS_MAP) {
        let iBox = _.cloneDeep(box);
        let compInfo = PAGE_FORM_COMPS_MAP[ compName ];
        iBox._name = compInfo.name;
        iBox._node = compName;
        iBox.body.input = compInfo.input;

        let valueVar = `${ compName.substr(2, compName.length - 6) }Value`;

        // console.log(`------------->>>> valueVar: ${ valueVar }`);
        iBox._value = valueVar;
        iBox.label._ss.text = compInfo.input._name;
        config.ele_style[ compName ] = iBox;
    }

    return config;
}

export default initPageFormItem;
